Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git] / 10359 - Tiling / p10359.java
blobe100750f2d89b9520b4458c6e627e8c6d0ef1137
1 /*
2 Problema: 10359 - Tiling
3 Aceptado por el juez de la UVa
4 Este código muestra tanto I/O como BigInteger
6 Autor: Andrés Mejía-Posada
7 */
8 import java.util.*;
9 import java.io.*;
10 import java.math.*;
12 class Main {
13 public static void main(String[] args) throws IOException {
14 BigInteger dp[] = new BigInteger[301];
15 dp[0] = BigInteger.ONE;
16 dp[1] = BigInteger.ONE;
17 for (int i=2; i<=300; ++i){
18 dp[i] = dp[i-1].add(dp[i-2].add(dp[i-2]));
20 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
21 String line = reader.readLine();
22 while (line != null && line.length() > 0){
23 int N = Integer.valueOf(line);
24 System.out.println(dp[N].toString());
25 line = reader.readLine();